import { computed } from "vue";
import { useStore } from "vuex";

export function useMapper(mappr: any, mapFn: any) {
  const store = useStore();
  const sStateFn = mapFn(mappr)
  const sState: any = {};
  Object.keys(sStateFn).forEach(fnKey => {
    const fn = sStateFn[fnKey].bind({$store: store});
    sState[fnKey] = computed(fn);
  })
  return sState
}